<?php
/**********************************************************
** Lime Manager
** Thomas Knobloch & Clément Troesch
** Administrator Instance Ajax View
***********************************************************/
?>

<?php include_once "../../model/AdministratorModel.php"; ?>
<?php include_once "../../model/SessionModel.php"; ?>
<?php session_start(); ?>

<div class="section_title" id="instance"><h1> Instance </h1></div>
<div class="section_info">
	Obtention des paramètres d'instance. 
</div>

<div class="article">

<?php
if(isset($_SESSION['session']->userLogin)){
?>
	<div class="tableContainer">
		<table class="tableQueryCenter">
			<tr>
			<?php
			if($_SESSION['session']->currentConnection->type == "MYSQL"){
			?>
				<th>Variable_name</th>
				<th>Value</th>
			<?php
			}
			else if($_SESSION['session']->currentConnection->type == "ORACLE"){
			?>				
				<th>Instance</th>
				<th>Numéro d'instance</th>
				<th>Identifiant</th>
				<th>Version</th>
				<th>Serveur</th>
				<th>Date de démarrage</th>
				<th>Status</th>
			<?php
			}
			?>
				
			</tr>
		<?php

		$nbrow = AdministratorModel::getInstanceInfos($_SESSION['session']->currentConnection, $result);
			foreach ($result as $row) {
				echo "<tr>";
				if($_SESSION['session']->currentConnection->type == "MYSQL"){
					echo "<td>".$row['Variable_name']."</td>\n";
					echo "<td>".$row['Value']."</td>\n";				
				}
				else if($_SESSION['session']->currentConnection->type == "ORACLE"){
					echo "<td>".$row['INSTANCE']."</td>\n";
					echo "<td>".(isset($row['INSTANCE_NUMBER'])?$row['INSTANCE_NUMBER']:"-")."</td>\n";
					echo "<td>".$row['IDENTIFIANT']."</td>\n";
					echo "<td>".$row['VERSION']."</td>\n";
					echo "<td>".$row['SERVEUR']."</td>\n";
					echo "<td>".$row['DATE_DEM']."</td>\n";
					echo "<td>".$row['STATUS']."</td>\n";
				}
				echo"</tr>";
			}
		}	
		?>
		</table>
	</div>
</div>
